<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <f:event type="preRenderView" listener="#{utilAdministrationBean.loadNextEvents()}"/>

    <p:outputPanel id="eventsPanel" layout="block" style="margin: 50px 0;">

        <h:form id="events-formId">
            <p:dataTable id="eventsData" var="e" value="#{utilAdministrationBean.events}"
                         emptyMessage="Nu sunt inregistrari"
                         styleClass="data-table-style data-table-panel">

                <p:column headerText="Data eveniment">
                    <h:outputText value="#{e.createdDate}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText>
                </p:column>

                <p:column headerText="Creat de">
                    <h:outputText value="#{e.createdByUser.folder.firstName} #{e.createdByUser.folder.lastName}" />
                </p:column>

                <p:column rendered="#{utilAdministrationBean.orderEventType(e.eventType)}">
                    <h:outputText value="Ordin din:"/>
                    <h:outputText value="#{e.order.createdDate}">
                        <f:convertDateTime pattern="dd/MM/yyyy"/>
                    </h:outputText>
                    <h:outputText value=", tip ordin: #{e.order.orderStateType.label}, pozitia: #{e.nodePath},
                                        creat pentru persoana: #{e.order.folder.firstName} #{e.order.folder.lastName}"/>
                </p:column>

                <p:column rendered="#{utilAdministrationBean.treeEventType(e.eventType)}">
                    <h:outputText value="#{e.treeChangesType.label}: #{e.nodePath}"/>
                </p:column>


            </p:dataTable>

            <p:commandButton value="Evenimente mai vechi" actionListener="#{utilAdministrationBean.loadNextEvents}"
                             update="@form"/>
        </h:form>

    </p:outputPanel>

</ui:composition>